<?

/**
 *  controller - the controller to use
 *  action - the action
 *  id - the id
 *  text - link text (defaults to uc'd action if not given)
 *
 */

function smarty_function_link( $params, $smarty ) {

	require_once $smarty->_get_plugin_filepath( 'modifier', 'escape' );
	require_once $smarty->_get_plugin_filepath( 'function', 'url' );

	$router = Smutty_Router::getInstance();
	$urlParams = Smutty_Utils::strToHash( $params['url'] );
	$text = $params['text'] ? $params['text'] : ucfirst($urlParams['action']);
	$url = Smutty_Utils::getUrl( $urlParams );

	echo '<a href="' . $url . '">' .
			smarty_modifier_escape($text) . '</a>';

}

?>